package com.geeguo.ebuilder.client.business.system.tempfile.service.impl;

import com.geeguo.ebuilder.client.base.database.annotation.TDS;
import com.geeguo.ebuilder.client.base.tenant.model.DataContext;
import com.geeguo.ebuilder.client.business.system.tempfile.mapper.TempFileMapper;
import com.geeguo.ebuilder.client.business.system.tempfile.model.TempFileEntity;
import com.geeguo.ebuilder.client.business.system.tempfile.service.TempFileService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class TempFileServiceImpl implements TempFileService {

    @Autowired
    private TempFileMapper tempFileMapper;

    @TDS
    @Override
    public TempFileEntity get(String id, DataContext dataContext) {
        return tempFileMapper.selectById(id);
    }

    @TDS
    @Override
    public boolean save(TempFileEntity entity, DataContext dataContext) {
        return tempFileMapper.insert(entity) > 0;
    }

    @TDS
    @Override
    public boolean remove(String id, DataContext dataContext) {
        return tempFileMapper.deleteById(id) == 1;
    }
}